
with open('test.txt', 'a+') as f:
    f.write('Hello World\n')
    f.write('Hello Python\n')